<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">


  <link rel="icon" type="image/png" sizes="16x16" href="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/avatar.jpg">

<link rel="stylesheet" href="/next/css/main.css">



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.3/css/all.min.css" integrity="sha256-2H3fkXt6FEmrReK448mDVGKb3WW2ZZw35gI7vqHOE4Y=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" integrity="sha256-Vzbj7sDDS/woiFS3uNKo8eIuni59rjyNGtXfstRzStA=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"cnhuazhu.gitee.io","root":"/next/","images":"/next/images","scheme":"Mist","version":"8.6.1","exturl":false,"sidebar":{"position":"left","Muse | Mist":320,"display":"post","padding":18,"offset":12},"copycode":true,"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":true,"mediumzoom":true,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/next/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/next/js/config.js"></script>
<meta name="description" content="介绍Jupyter Notebook的基本配置流程以及使用方法">
<meta property="og:type" content="article">
<meta property="og:title" content="Jupyter Notebook基本配置及使用方法">
<meta property="og:url" content="https://cnhuazhu.gitee.io/next/2021/02/08/Jupyter%20Notebook/Jupyter%20Notebook%E5%9F%BA%E6%9C%AC%E9%85%8D%E7%BD%AE%E5%8F%8A%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95/index.html">
<meta property="og:site_name" content="花猪のBlog">
<meta property="og:description" content="介绍Jupyter Notebook的基本配置流程以及使用方法">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E6%96%B0%E5%BB%BA%E7%AC%94%E8%AE%B0.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E7%BC%96%E5%86%99%E4%BB%A3%E7%A0%81%E5%B9%B6%E8%BF%90%E8%A1%8C.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E5%8F%AF%E7%94%A8%E4%B8%BB%E9%A2%98.png">
<meta property="article:published_time" content="2021-02-07T16:23:46.000Z">
<meta property="article:modified_time" content="2021-02-19T13:42:52.664Z">
<meta property="article:author" content="花猪">
<meta property="article:tag" content="Jupyter">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E6%96%B0%E5%BB%BA%E7%AC%94%E8%AE%B0.png">


<link rel="canonical" href="https://cnhuazhu.gitee.io/next/2021/02/08/Jupyter%20Notebook/Jupyter%20Notebook%E5%9F%BA%E6%9C%AC%E9%85%8D%E7%BD%AE%E5%8F%8A%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://cnhuazhu.gitee.io/next/2021/02/08/Jupyter%20Notebook/Jupyter%20Notebook%E5%9F%BA%E6%9C%AC%E9%85%8D%E7%BD%AE%E5%8F%8A%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95/","path":"2021/02/08/Jupyter Notebook/Jupyter Notebook基本配置及使用方法/","title":"Jupyter Notebook基本配置及使用方法"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>Jupyter Notebook基本配置及使用方法 | 花猪のBlog</title>
  




  <noscript>
    <link rel="stylesheet" href="/next/css/noscript.css">
  </noscript>
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/next/" class="brand" rel="start">
      <i class="logo-line"></i>
      <h1 class="site-title">花猪のBlog</h1>
      <i class="logo-line"></i>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu">
        <li class="menu-item menu-item-主站"><a href="https://cnhuazhu.top/" rel="noopener" target="_blank"><i class="fas fa-chevron-right fa-fw"></i>主站</a></li>
        <li class="menu-item menu-item-home"><a href="/next/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li>
        <li class="menu-item menu-item-tags"><a href="/next/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签<span class="badge">14</span></a></li>
        <li class="menu-item menu-item-categories"><a href="/next/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类<span class="badge">8</span></a></li>
        <li class="menu-item menu-item-archives"><a href="/next/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档<span class="badge">53</span></a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%89%8D%E8%A8%80"><span class="nav-number">1.</span> <span class="nav-text">前言</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E7%AE%80%E4%BB%8B"><span class="nav-number">2.</span> <span class="nav-text">简介</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%AE%89%E8%A3%85"><span class="nav-number">3.</span> <span class="nav-text">安装</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BD%BF%E7%94%A8"><span class="nav-number">4.</span> <span class="nav-text">使用</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%96%B0%E5%BB%BA%E7%AC%94%E8%AE%B0"><span class="nav-number">4.1.</span> <span class="nav-text">新建笔记</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E9%87%8D%E5%91%BD%E5%90%8D"><span class="nav-number">4.2.</span> <span class="nav-text">重命名</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E7%BC%96%E5%86%99%E4%BB%A3%E7%A0%81%E5%B9%B6%E8%BF%90%E8%A1%8C"><span class="nav-number">4.3.</span> <span class="nav-text">编写代码并运行</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%BF%9D%E5%AD%98notebook"><span class="nav-number">4.4.</span> <span class="nav-text">保存notebook</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%9B%9E%E9%80%80%E8%AE%B0%E5%BD%95%E7%82%B9"><span class="nav-number">4.5.</span> <span class="nav-text">回退记录点</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E6%9B%B4%E6%94%B9%E4%B8%BB%E9%A2%98"><span class="nav-number">5.</span> <span class="nav-text">更改主题</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%8F%AF%E8%83%BD%E9%81%87%E5%88%B0%E7%9A%84%E9%97%AE%E9%A2%98"><span class="nav-number">6.</span> <span class="nav-text">可能遇到的问题</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E8%BE%93%E5%85%A5jupyter-notebook%E5%91%BD%E4%BB%A4%E6%97%A0%E6%B3%95%E6%AD%A3%E5%B8%B8%E5%BC%B9%E5%87%BA%E6%B5%8F%E8%A7%88%E5%99%A8"><span class="nav-number">6.1.</span> <span class="nav-text">输入jupyter notebook命令无法正常弹出浏览器</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E7%BB%93%E8%AF%AD"><span class="nav-number">7.</span> <span class="nav-text">结语</span></a></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-overview">
            <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="花猪"
      src="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/avatar.jpg">
  <p class="site-author-name" itemprop="name">花猪</p>
  <div class="site-description" itemprop="description">为了获得不同的阅读体验，建立此分站。<br>（可在导航栏搜索想要查看的文章）<br><br>本站主题：NEXT 8.6.1</div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/next/archives/">
        
          <span class="site-state-item-count">53</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/next/categories/">
          
        <span class="site-state-item-count">8</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/next/tags/">
          
        <span class="site-state-item-count">14</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author site-overview-item animated">
      <span class="links-of-author-item">
        <a href="https://github.com/CNhuazhu" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;CNhuazhu" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>



          </div>
        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>

  <a href="https://github.com/CNhuazhu" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://cnhuazhu.gitee.io/next/2021/02/08/Jupyter%20Notebook/Jupyter%20Notebook%E5%9F%BA%E6%9C%AC%E9%85%8D%E7%BD%AE%E5%8F%8A%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/avatar.jpg">
      <meta itemprop="name" content="花猪">
      <meta itemprop="description" content="为了获得不同的阅读体验，建立此分站。<br>（可在导航栏搜索想要查看的文章）<br><br>本站主题：NEXT 8.6.1">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="花猪のBlog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          Jupyter Notebook基本配置及使用方法
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2021-02-08 00:23:46" itemprop="dateCreated datePublished" datetime="2021-02-08T00:23:46+08:00">2021-02-08</time>
    </span>
      <span class="post-meta-item">
        <span class="post-meta-item-icon">
          <i class="far fa-calendar-check"></i>
        </span>
        <span class="post-meta-item-text">更新于</span>
        <time title="修改时间：2021-02-19 21:42:52" itemprop="dateModified" datetime="2021-02-19T21:42:52+08:00">2021-02-19</time>
      </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/next/categories/Python/" itemprop="url" rel="index"><span itemprop="name">Python</span></a>
        </span>
    </span>

  
    <span id="/next/2021/02/08/Jupyter%20Notebook/Jupyter%20Notebook%E5%9F%BA%E6%9C%AC%E9%85%8D%E7%BD%AE%E5%8F%8A%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95/" class="post-meta-item leancloud_visitors" data-flag-title="Jupyter Notebook基本配置及使用方法" title="阅读次数">
      <span class="post-meta-item-icon">
        <i class="far fa-eye"></i>
      </span>
      <span class="post-meta-item-text">阅读次数：</span>
      <span class="leancloud-visitors-count"></span>
    </span>
    <span id="/next/2021/02/08/Jupyter%20Notebook/Jupyter%20Notebook%E5%9F%BA%E6%9C%AC%E9%85%8D%E7%BD%AE%E5%8F%8A%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95/" class="post-meta-item twikoo_visitors" data-flag-title="Jupyter Notebook基本配置及使用方法" title="阅读次数">
      <span class="post-meta-item-icon">
        <i class="far fa-eye"></i>
      </span>
      <span class="post-meta-item-text">阅读次数：</span>
      <span id="twikoo_visitors"></span>
    </span>
  
      </div>
      <div class="post-meta">
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>3.5k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>3 分钟</span>
    </span>
</div>

            <div class="post-description">介绍Jupyter Notebook的基本配置流程以及使用方法</div>
        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <h1 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h1><p>本文将介绍一款强大的轻量级集成开发环境：<code>Jupyter Notebook</code>的基本配置流程以及使用方法。</p>
<hr>
<h1 id="简介"><a href="#简介" class="headerlink" title="简介"></a>简介</h1><blockquote>
<p>Jupyter Notebook是基于网页的用于交互计算的应用程序。其可被应用于全过程计算：开发、文档编写、运行代码和展示结果。——<a target="_blank" rel="noopener" href="https://jupyter-notebook.readthedocs.io/en/stable/notebook.html">Jupyter Notebook官方介绍</a></p>
</blockquote>
<p>简而言之，Jupyter Notebook是以网页的形式打开，可以在网页页面中<strong>直接</strong>编写代码和运行代码，代码的运行结果也会直接在代码块下显示。如在编程过程中需要编写说明文档，可在同一个页面中直接编写，便于作及时的说明和解释。</p>
<p><strong>Jupyter Notebook的主要特点：</strong></p>
<ol>
<li>编程时具有语法高亮、缩进、tab补全的功能。</li>
<li>可直接通过浏览器运行代码，同时在代码块下方展示运行结果。</li>
<li>以富媒体格式展示计算结果。富媒体格式包括：HTML，LaTeX，PNG，SVG等。</li>
<li>对代码编写说明文档或语句时，支持Markdown语法</li>
<li>支持使用LaTeX编写数学性说明。</li>
</ol>
<hr>
<h1 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h1><p><strong>1.使用如下pip命令安装</strong></p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pip install jupyter</span><br></pre></td></tr></table></figure>

<p><strong>2.验证安装是否成功</strong></p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">jupyter notebook -<span class="literal">-no</span><span class="literal">-browser</span></span><br></pre></td></tr></table></figure>

<p>如果出现以下内容,则Jupyter Notebook已经在正常运行，按<code>Ctrl+c</code>结束运行</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">I</span> <span class="number">00</span>:<span class="number">38</span>:<span class="number">58.788</span> <span class="type">NotebookApp</span>] Serving notebooks from local directory: G:/Jupyter Notebook</span><br><span class="line">[<span class="type">I</span> <span class="number">00</span>:<span class="number">38</span>:<span class="number">58.788</span> <span class="type">NotebookApp</span>] Jupyter Notebook <span class="number">6.2</span>.<span class="number">0</span> is running at:</span><br><span class="line">[<span class="type">I</span> <span class="number">00</span>:<span class="number">38</span>:<span class="number">58.788</span> <span class="type">NotebookApp</span>] http://localhost:<span class="number">8888</span>/?token=<span class="number">5</span>f376397a2519ea17b951e5968ed4621a7a254efd1b7807d</span><br><span class="line">[<span class="type">I</span> <span class="number">00</span>:<span class="number">38</span>:<span class="number">58.788</span> <span class="type">NotebookApp</span>]  or http://<span class="number">127.0</span>.<span class="number">0.1</span>:<span class="number">8888</span>/?token=<span class="number">5</span>f376397a2519ea17b951e5968ed4621a7a254efd1b7807d</span><br><span class="line">[<span class="type">I</span> <span class="number">00</span>:<span class="number">38</span>:<span class="number">58.788</span> <span class="type">NotebookApp</span>] Use Control<span class="literal">-C</span> to stop this server and shut down all kernels (twice to skip confirmation).</span><br><span class="line">[<span class="type">C</span> <span class="number">00</span>:<span class="number">38</span>:<span class="number">58.788</span> <span class="type">NotebookApp</span>]</span><br><span class="line"></span><br><span class="line">    To access the notebook, open this file <span class="keyword">in</span> a browser:</span><br><span class="line">        file:///C:/Users/%E7%<span class="number">8</span>E%<span class="number">8</span>B%E9%B9%<span class="number">8</span>F%E5%AE%<span class="number">87</span>/AppData/Roaming/jupyter/runtime/nbserver<span class="literal">-31952</span><span class="literal">-open</span>.html</span><br><span class="line">    Or <span class="built_in">copy</span> and paste one of these URLs:</span><br><span class="line">        http://localhost:<span class="number">8888</span>/?token=<span class="number">5</span>f376397a2519ea17b951e5968ed4621a7a254efd1b7807d</span><br><span class="line">     or http://<span class="number">127.0</span>.<span class="number">0.1</span>:<span class="number">8888</span>/?token=<span class="number">5</span>f376397a2519ea17b951e5968ed4621a7a254efd1b7807d</span><br></pre></td></tr></table></figure>

<p><strong>3.启动</strong></p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">jupyter notebook</span><br></pre></td></tr></table></figure>

<p>至此就可以正常使用Jupyter Notebook了。</p>
<p><strong>注意：</strong>正常情况该命令会自动弹出浏览器，如果遇到<code>无法正常弹出</code>浏览器，<a href="#%E6%97%A0%E6%B3%95%E5%BC%B9%E5%87%BA%E6%B5%8F%E8%A7%88%E5%99%A8"><strong>点击此处</strong></a>查看解决办法。</p>
<p><strong>4.修改笔记路径</strong></p>
<p>Jupyter Notebook的文件默认存储路径在C盘，为了便于操作，建议修改路径。</p>
<p>输入以下命令找到<code>jupyter_notebook_config.py</code>配置文件的路径，并打开。</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">jupyter notebook -<span class="literal">-generate</span><span class="literal">-config</span></span><br></pre></td></tr></table></figure>

<p><code>Ctrl+f</code>搜索<code>c.NotebookApp.notebook_dir = &#39;&#39;</code>代码位置，将其注释去掉，并在单引号间添加想设置的路径，如下：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">c.NotebookApp.notebook_dir = <span class="string">&#x27;G:/Jupyter Notebook&#x27;</span></span><br></pre></td></tr></table></figure>

<p><em>注意：路径要使用反斜杠</em></p>
<p>保存，退出。完成路径修改。</p>
<hr>
<h1 id="使用"><a href="#使用" class="headerlink" title="使用"></a>使用</h1><h2 id="新建笔记"><a href="#新建笔记" class="headerlink" title="新建笔记"></a>新建笔记</h2><p>如下图，点击右侧<code>New</code>下拉按钮，选择<code>Python 3</code>，即创建了一个笔记。</p>
<p><img src="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E6%96%B0%E5%BB%BA%E7%AC%94%E8%AE%B0.png"></p>
<h2 id="重命名"><a href="#重命名" class="headerlink" title="重命名"></a>重命名</h2><p>新建的notebook默认名称为：<code>Untitled</code>。</p>
<p>这里推荐两种重命名方式：</p>
<ol>
<li>当notebook正在运行时：直接在<code>notebook</code>页面，点击文件名称，即可修改文件名。</li>
<li>当notebook停止运行时：进入<code>File</code>选项卡，选中将要修改名称的文件（在文件左侧打勾），点击<code>Rename</code>按钮，即可修改文件名。</li>
</ol>
<h2 id="编写代码并运行"><a href="#编写代码并运行" class="headerlink" title="编写代码并运行"></a>编写代码并运行</h2><p><img src="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E7%BC%96%E5%86%99%E4%BB%A3%E7%A0%81%E5%B9%B6%E8%BF%90%E8%A1%8C.png"></p>
<p>如图，说明：</p>
<ol>
<li>新建的notebook默认只有一个单元格，前面以<code>In []</code>作为标记，该单元格用来编写代码。</li>
<li>点击工具栏中的按钮<code>运行（Run）</code>运行单元格中的代码，运行结果显示在单元格下方。</li>
<li><code>In []</code>中添加的数字表示：该单元格在内核上运行的顺序。</li>
<li>代码运行中：标记中的<code>[]</code>中添加了一个<code>*</code>；页面右上角的小圆圈变为了实心。</li>
<li>代码运行结束：<code>[]</code>中的<code>*</code>变为数字；页面右上角的小圆圈变为了空心。</li>
</ol>
<h2 id="保存notebook"><a href="#保存notebook" class="headerlink" title="保存notebook"></a>保存notebook</h2><p><strong>自动保存</strong>：对notebook进行修改后，默认情况下，在两分钟后notebook会被自动保存。</p>
<p><em>注意：notebook被自动保存时，相应的记录点文件不会发生任何变化</em></p>
<p><strong>手动保存</strong>：点击保存按钮即可手动保存。<em>（记录点文件会发生变化）</em></p>
<h2 id="回退记录点"><a href="#回退记录点" class="headerlink" title="回退记录点"></a>回退记录点</h2><p>可以随时回退到上一次记录点，以撤销这期间做出的任何修改。</p>
<p><strong>记录点文件：</strong>每当创建一个新的notebook时，都会自动创建一个记录点文件，用于记录该notebook在某个时刻的所有状态。</p>
<p><strong>位置：</strong>在notebook的同级目录中，有一个名为<code>.ipynb_checkpoints</code>的目录，里面包含每个notebook的记录点文件。</p>
<p><strong>命名规则：</strong>notebook的文件名-checkpoint.ipynb</p>
<p><strong>回退记录点：</strong>点击菜单栏中的<code>File</code>，在弹出的菜单中点击<code>Revert to Checkpoint</code>中的日期和时间，以进行回退。</p>
<hr>
<h1 id="更改主题"><a href="#更改主题" class="headerlink" title="更改主题"></a>更改主题</h1><p>为了获得更好的体验，可以更改默认的主题。</p>
<p>安装第三方库<code>jupyterthemes</code>：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pip install jupyterthemes</span><br></pre></td></tr></table></figure>

<p>如果是使用Anaconda，则使用如下命令：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">conda install jupyterthemes</span><br></pre></td></tr></table></figure>

<p>列出所有可用的主题：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">jt <span class="literal">-l</span></span><br></pre></td></tr></table></figure>

<p><img src="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E5%8F%AF%E7%94%A8%E4%B8%BB%E9%A2%98.png"></p>
<p>各种<a target="_blank" rel="noopener" href="https://blog.csdn.net/DSTJWJW/article/details/85304390">主题展示</a>（图）</p>
<p>使用某个主题：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">jt <span class="literal">-t</span> 某个可用主题的名称</span><br></pre></td></tr></table></figure>

<p>恢复默认：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">jt <span class="literal">-r</span></span><br></pre></td></tr></table></figure>

<p>打印出命令<code>jt</code>的用法和所有可选参数：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">jt <span class="literal">-h</span></span><br></pre></td></tr></table></figure>

<p>一些常用的可选参数：</p>
<table>
<thead>
<tr>
<th>可选参数</th>
<th>参数的含义</th>
<th>默认值</th>
</tr>
</thead>
<tbody><tr>
<td>-T</td>
<td>Toolbar Visible（工具栏可见）</td>
<td>无</td>
</tr>
<tr>
<td>-N</td>
<td>Name Visible（名称可见）</td>
<td>无</td>
</tr>
<tr>
<td>-kl</td>
<td>Kernel Logo Visible（内核Logo可见）</td>
<td>无</td>
</tr>
<tr>
<td>-f</td>
<td>Code Font（代码的字体）</td>
<td>无</td>
</tr>
<tr>
<td>-fs</td>
<td>Code Font-Size（代码的字体大小）</td>
<td>11</td>
</tr>
<tr>
<td>-tf</td>
<td>Text Cell Font（文本单元格的字体）</td>
<td>无</td>
</tr>
<tr>
<td>-tfs</td>
<td>Text Cell Font-Size（文本单元格的字体大小）</td>
<td>13</td>
</tr>
<tr>
<td>-nf</td>
<td>Notebook Font（Notebook的字体）</td>
<td>无</td>
</tr>
<tr>
<td>-nfs</td>
<td>Notebook Font-Size（Notebook的字体大小）</td>
<td>13</td>
</tr>
<tr>
<td>-ofs</td>
<td>Output Area Font-Size（输出区域的字体大小）</td>
<td>8.5</td>
</tr>
</tbody></table>
<p>更多其他参数查看点击此链接：<a target="_blank" rel="noopener" href="https://github.com/dunovank/jupyter-themes">https://github.com/dunovank/jupyter-themes</a></p>
<p>具体使用案例，本人比较喜欢<code>onedork</code>主题样式，因此在该主题上进行修改。</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">jt <span class="literal">-t</span> onedork <span class="operator">-f</span> hasklig <span class="literal">-cellw</span> <span class="number">80</span>% <span class="literal">-T</span> <span class="literal">-N</span> <span class="literal">-kl</span> <span class="literal">-altmd</span> <span class="literal">-fs</span> <span class="number">16</span> <span class="literal">-ofs</span> <span class="number">14</span></span><br></pre></td></tr></table></figure>

<hr>
<h1 id="可能遇到的问题"><a href="#可能遇到的问题" class="headerlink" title="可能遇到的问题"></a>可能遇到的问题</h1><h2 id="输入jupyter-notebook命令无法正常弹出浏览器"><a href="#输入jupyter-notebook命令无法正常弹出浏览器" class="headerlink" title="输入jupyter notebook命令无法正常弹出浏览器"></a><span id="无法弹出浏览器">输入<code>jupyter notebook</code>命令无法正常弹出浏览器</span></h2><p>输入以下命令找到<code>jupyter_notebook_config.py</code>配置文件的路径，并打开。</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">jupyter notebook -<span class="literal">-generate</span><span class="literal">-config</span></span><br></pre></td></tr></table></figure>

<p><code>Ctrl+f</code>搜索<code>c.NotebookApp.password =</code>代码位置，在其后（另起一行），输入：</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> webbrowser</span><br><span class="line">webbrowser.register(<span class="string">&#x27;chrome&#x27;</span>, <span class="literal">None</span>, webbrowser.GenericBrowser(<span class="string">u&#x27;C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe&#x27;</span>))</span><br><span class="line">c.NotebookApp.browser = <span class="string">&#x27;chrome&#x27;</span></span><br></pre></td></tr></table></figure>

<p><strong>注意：</strong>这里使用的是<code>chrome</code>浏览器，注意要将<code>chrome.exe</code>路径填写正确，使用<code>双斜杠</code>。</p>
<p>保存，退出。完成修改。</p>
<hr>
<h1 id="结语"><a href="#结语" class="headerlink" title="结语"></a>结语</h1><p>遇到问题或用法再继续补充~</p>

    </div>

    
    
    
      
  <div class="popular-posts-header">相关文章</div>
  <ul class="popular-posts">
    <li class="popular-posts-item">
      <div class="popular-posts-title"><a href="\next\2021\02\08\Jupyter Notebook\Jupyter Notebook使用技巧\" rel="bookmark">Jupyter Notebook使用技巧</a></div>
    </li>
  </ul>


    <footer class="post-footer">
          <div class="reward-container">
  <div></div>
  <button>
    赞赏
  </button>
  <div class="post-reward">
      <div>
        <img src="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/wechat.png" alt="花猪 微信">
        <span>微信</span>
      </div>
      <div>
        <img src="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/alipay.jpg" alt="花猪 支付宝">
        <span>支付宝</span>
      </div>

  </div>
</div>

          <div class="post-tags">
              <a href="/next/tags/Jupyter/" rel="tag"><i class="fa fa-tag"></i> Jupyter</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/next/2021/02/06/Python%20OSError-Errno-22-Invalid-argument%20%E9%94%99%E8%AF%AF%E8%A7%A3%E5%86%B3/" rel="prev" title="Python OSError: [Errno 22] Invalid argument 错误解决">
                  <i class="fa fa-chevron-left"></i> Python OSError: [Errno 22] Invalid argument 错误解决
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/next/2021/02/08/Jupyter%20Notebook/Jupyter%20Notebook%E4%BD%BF%E7%94%A8%E6%8A%80%E5%B7%A7/" rel="next" title="Jupyter Notebook使用技巧">
                  Jupyter Notebook使用技巧 <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






    <div class="comments"><div id="twikoo-comments"></div></div>
</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">花猪</span>
</div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
      <span>站点总字数：</span>
    <span title="站点总字数">356k</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span>站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">5:23</span>
  </span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/mist/" rel="noopener" target="_blank">NexT.Mist</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/@next-theme/pjax@0.5.0/pjax.min.js" integrity="sha256-3NkoLDrmHLTYj7csHIZSr0MHAFTXth7Ua/DDt4MRUAg=" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js" integrity="sha256-yt2kYMy0w8AbtF89WXb2P1rfjcP/HTHLT7097U8Y5b8=" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/medium-zoom@1.0.6/dist/medium-zoom.min.js" integrity="sha256-EdPgYcPk/IIrw7FYeuJQexva49pVRZNmt3LculEr7zM=" crossorigin="anonymous"></script>
<script src="/next/js/comments.js"></script><script src="/next/js/utils.js"></script><script src="/next/js/motion.js"></script><script src="/next/js/schemes/muse.js"></script><script src="/next/js/next-boot.js"></script><script src="/next/js/pjax.js"></script>

  
<script src="/next/js/third-party/search/local-search.js"></script>




  


  <script class="next-config" data-name="leancloud_visitors" type="application/json">{"enable":true,"app_id":"dh8GVAcIwU1TN4zhA5y63iW1-gzGzoHsz","app_key":"hzyAqDKjG4OBGrdPS7mKaOa7","server_url":null,"security":true}</script>
  <script src="/next/js/third-party/statistics/lean-analytics.js"></script>


  

  <script class="next-config" data-name="enableMath" type="application/json">true</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"none","js":{"url":"https://cdn.jsdelivr.net/npm/mathjax@3.2.0/es5/tex-mml-chtml.js","integrity":"sha256-r+3itOMtGGjap0x+10hu6jW/gZCzxHsoKrOd7gyRSGY="}}</script>
<script src="/next/js/third-party/math/mathjax.js"></script>


<script class="next-config" data-name="twikoo" type="application/json">{"enable":true,"visitor":true,"envId":"hexo-1g41404w9f800e94","el":"#twikoo-comments"}</script>
<script>
document.addEventListener('page:loaded', () => {
  NexT.utils.loadComments(CONFIG.twikoo.el)
    .then(() => NexT.utils.getScript(
      'https://cdn.jsdelivr.net/npm/twikoo/dist/twikoo.all.min.js',
      { condition: window.twikoo }
    ))
    .then(() => {
      twikoo.init(CONFIG.twikoo);
    });
});
</script>

</body>
</html>
